package 代码记录.Bit48天集训;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**1.统计每个月兔子的总数(已搞定)
 * 2.字符串通配符
 * @author zx
 * @create 2022-05-14 18:18
 */
public class day_18 {
    /**
     * 本题是在变相考察斐波那契数列.
     * 第n个月的兔子数量由两部分组成,一部分是上个月的兔子f(n-1),另一部是满足3个月大的兔子,会生一只兔子f(n-2).
     * 所以第n个月兔子总数：f(n) = f(n-1) + f(n-2).
     * @param args
     */
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] dp = new int[n + 1];
        dp[1] = 1;
        dp[2] = 1;
        for(int i = 3;i <= n;i++){
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        System.out.println(dp[n]);
    }

    /**
     * @param args 用例通过率23.53%
     */
    public static void main2(String[] args){
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        str1 = str1.toLowerCase();
        str2 = str2.toLowerCase();
        char[] arr = new char[26];
        char[] arr2 = new char[10];
        Set<Character> set = new HashSet<>();
        for(int i = 0;i < arr.length;i++){
            arr[i] =  (char)('a' + i);
            set.add(arr[i]);
        }
        for(int i = 0;i < arr2.length;i++){
            arr[i] = (char)('0' + i);
            set.add(arr[i]);
        }
        boolean flag = true;
        for(int i = 0;i < str2.length();i++){
            if(set.contains(str1.charAt(i)) && str1.charAt(i) == str2.charAt(i)){
                continue;
            }else if(set.contains(str1.charAt(i)) && str1.charAt(i) != str2.charAt(i)){
                System.out.println("false");
                flag = false;
                break;
            }
            if(str1.charAt(i) == '?' && set.contains(str2.charAt(i))){
                continue;
            }else if(str1.charAt(i) == '?' && !set.contains(str2.charAt(i))){
                System.out.println("false");
                flag = false;
                break;
            }
            if(str1.charAt(i) == '*' && set.contains(str2.charAt(i))){
                System.out.println("true");
                for(int j = i;j < str1.length();j++){
                    if(!set.contains(str1.charAt(i))){
                        System.out.println("false");
                        flag = false;
                    }
                }
                break;
            }else if(str1.charAt(i) == '*' && !set.contains(str2.charAt(i))){
                System.out.println("false");
                flag = false;
                break;
            }
            if(flag){
                System.out.println("true");
            }
        }
    }
}
